package com.test.p05builder.example01;

public class ShenZhouAirShipDirector implements  AirShipDirector {

    private AirShipBuilder builder;

    public ShenZhouAirShipDirector(AirShipBuilder builder) {
        this.builder = builder;
    }

    @Override
    public AirShip create() {
        Engine engine = builder.buildEngine();

        OrbitalModule orbitalModule = builder.buildOrbitalModule();

        EscapeTower escapeTower = builder.buildEscapeTower();
        AirShip ship = new AirShip();
        ship.setEngine(engine);
        ship.setEscapeTower(escapeTower);
        ship.setOrbitalModel(orbitalModule);
        return ship;
    }
}
